﻿/*
* BattleScene.h
*
* 战斗场景
*
* create date: 2014.4.10
* create by: leo
*
*/

#ifndef _BATTLESCENE_H_
#define _BATTLESCENE_H_

#include "BaseScene.h"

#include "../heros/BaseHero.h"
#include "../corps/BaseCorps.h"

#include "CocoStudio/GUI/System/CocosGUI.h"

class CBattleScene : public CBaseScene, private IBaseHeroStateListener
{
public:
	static CBaseScene* create();

	/*
	 * 设置左方队伍
	 *
	 * corps 队伍
	 */
	void setLeftCorps(CBaseCorps& corps);
	/*
	 * 设置右方队伍
	 *
	 * corps 队伍
	 */
	void setRightCorps(CBaseCorps& corps);

	/*
	 * 获取敌对队伍
	 */
	CBaseCorps* getEnemyCorps(CBaseCorps& corps);
	/*
	 * 准备战斗资源
	 */
	void prepare();
	bool isPrepared();
	/*
	 * 开始战斗
	 */
	void startBattle();

	void addSortNode(cocos2d::CCNode* node);
	void removeSortNode(cocos2d::CCNode* node);

	void onDefeat(cocos2d::CCObject* obj);

protected:
	CBattleScene(void);
	virtual ~CBattleScene(void);

	virtual bool init(void);

private:
	virtual void onDied(CBaseHero& hero);
	virtual void onPositionChange(CBaseHero& hero);

protected:
	CBaseCorps* mLeftCorps;
	CBaseCorps* mRightCorps;
    
	bool mPrepared;

	cocos2d::CCArray mSortNodes;
};

#endif // _BATTLESCENE_H_
